26 Sep 2024
My Home Server Setup
Introduction: Why did I set up a Home Server?
A few months ago I received a notification, my Google photos storage had run out. I used Google Photos like a lot of people to store my photos, and it had a lot of things going for it: 15GB of free storage, a very clean mobile interface and a web interface too. Facial recognition, location-based photos… really great stuff.
For me, the problem was storage, I was taking too many photos! I had previously created multiple accounts to try to circumvent this issue; each new account gives you 15GB of extra storage. In the span of about 6 months my other Google account had reached 15 GB of storage too!
What to do?
Well, I could pay monthly to expand this storage to 100GB. A suitable solution for some.
My issues with this approach are:
- I don’t control where my photos are kept.
- I have to pay monthly or I lose the ability to upload more photos.
- 100GB may not be enough! If I use 15GB every 6 months, I would have to upgrade my storage plan in a few years.
There are, however, some benefits to this:
- Robust backups of data. Google has multiple data storage facilities with redundant copies of data to ensure data is not lost.
- Robust security of data. This point and the previous point are required by law, so it’s unlikely that my photos get accessed maliciously.
- Always-on-access. Maintenance is handled by Google, who aim to keep the service running 99% of the time.
Is there another solution?
Yes! Enter immich, a self hosted alternative to Google photos. Want facial recognition? Included. Want location-based maps view? Included, and much more.
Immich inspired me to set up my own home server with remote access. This means I am in control of sensitive information and it’s actually cheaper in the long run!
The Services
Photos Storage Solution
There is a robust web and mobile app for Immich, which features timeline-based view, keyword search, location-based photos, and more.
Of all the services I’ve set up on my server, Immich is the best-documented. From backups, to imports, to remote access.
You might be wondering, how would I import my Google Photos to Immich? Immich-Go is an open-source tool designed to streamline uploading large photo collections to your self-hosted Immich server. I was able to download my Google data using Google Takeout, isolate the photos, and then run Immich-go to bulk-import all photos. The initial import process takes a while and is resource-intensive.
I would also recommend following the Immich documentation on how to backup photos and videos.
Make sure you test this backup process.
No more storage woes!
Location History
I wanted a way to view where I had been on a map. I wanted to see each day as a historical timeline on a map. Google Timeline is a service that does this, but I wanted a service that I controlled, and an interface that was more suitable for my use case.
I had initially set up Owntracks. Owntracks runs similarly to Immich: you have a server, and an app, and they communicate.
The owntracks app has really high customisability, and negligible effect on battery life in my opinion. You can specify how often you ping the server, and the minimum distance to travel before sending another ping.
My issue with Owntracks was the front-end dashboard. It didn’t have as many features as I wanted, and it’s performance was poor, especially when you consider we are just viewing a map.
I finally settled on Traccar. The name suggests it tracks cars, but it’s working great for my use case too!
Not only can I view a specific day’s history, I can replay the entire day to find out where I was exactly at a point in time. I can also view my speed and the route I took to a destination. All this is accessible with a fast UI on the web app, and the mobile app, which is the main reason I am using Traccar.
Instead of using the Traccar client to send pings from my phone, I am sending it from the Owntracks app and just modifying the destination port. This is because the Traccar client app would not send pings from my phone.
Calendar
Radicale allows me to host my own calendar server, and send two-way syncs from my phone and computer.
Any maintenance you need to do can be done through the Radicale Web App.
I am using the GNOME Calendar app on Ubuntu (Computer), which syncs to the CalDAV URL for Radicale.
I am also using Fossify Calendar on LineageOS (phone). DAVx5 is used for syncing to the same CalDAV URL.
This was one of the simpler setups!
Notes Storage
I had been struggling with my notes setup for a while. Originally I used OneNote, which was good, but I wanted something where I controlled the storage and which had better performance.
Joplin is an open-source note-taking app. It features a notebook-style UI, with fast search and a rich markdown editor. It is offline-first, so your notes are always on-device.
It also allows you to self-host! One option is to host through Joplin Server, which is a Docker-hostable instance to synchronise notes through. It features an admin panel for maintenance and is much faster, in my experinece, than using a seperate provider like OneDrive (but that is certainly an option).
File Storage
My next objective was a file server. I needed something similar to OneDrive, where you can upload files from your phone, and see them on your computer, and vice versa and so on.
Samba is a free software implementation of the SMB file-sharing protocol. It allows me to access my home server’s drive and upload, delete and modify files.
I can access it using the GNOME file explorer, and using Cx file explorer on Android.
I ran into an issue where I accidentally deleted some files on my server. At this point I realised I needed a recycling bin. So now, whenever a file is deleted, it is sent to the remote recycling bin - just in case!
ChatGPT Alternative
I wanted a self-hosted Large Language Model that I could interact with remotely.
Ollama allows me to run LLMs on my local machines. Open WebUI allows me to interact with Ollama through a web interface.
I am currently using Llama3.1 8B for my use, which is runnable on my desktop
I wasn’t sure how feasible this idea was, but it worked!
Remote Access
It’s all well and good being able to access your services on your home network, but what about remote access?
How do I access my services over the internet when I am outside? And how do I do it securely?
Tailscale is a service which initiates a WireGuard VPN connection between clients on a network. I can add my phone, computer and home server to this network, and Tailscale manages the VPN connection so that IP addresses don’t get changed.
Tailscale Magic DNS also allows me to connect using just the name of my machine, instead of the Tailscale IP
The Hardware
“Not much you can do without a CPU!”
A Thinkpad E580: This handy, robust, on-its-knees device hosts all of my essential services, and with suitable speed.
- It has 8GB RAM and an Intel i5 CPU.
- It runs off a SATA SSD, but I was able to open it up and install an NVME 500GB drive on it. This is for fast access to images, and certain backups. I also added an external 1TB HDD, for extra storage.
- rtcwake and cron jobs are used to conserve energy and execute backups over night, when I am unlikely to be using the server.
A gaming computer: (nickname beast): This is a secondary device which is also remotely accessible for Ollama.
- 12 GB RAM, i5-9400F, GTX 1060 6GB. Not extremely beefy compared to modern gaming computers, but I only need it for running ollama, which it does suitably fast.
- To conserve energy for the Home Beast, it’s default state is off, unlike the Home Server.
- It’s controlled by a Python Flask web app hosted on the Home Server, which has two buttons.
- The shut down button redirects to another Flask application, which the Home Beast initiates on startup. On visit to this site, the Home Beast shuts down.
- The power on button makes the Home Server send a Wake-On-LAN request to the Home Beast using etherwake. This has proven to be quite reliable for me
Conclusion: Next Steps?
I’m not sure what else I want on my home server, but I’m sure I’ll think of something!
Ultimately though, I feel more in control of my data, and more productive when I know how my services work, and where to find them.
With a robust configuration that handles backups, and using as many offline-first services as possible, I can be sure my data will not be lost, and that these services are scalable, even when I use them in the long term.